home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 15 / Amiga Plus Leser CD 15.iso / Tools / Development / AmigaTalk_X / intuition / GadgetActivation.st < prev    next >
Encoding:
Text File  |  2002-03-13  |  2.3 KB  |  62 lines

  1. " -------------------------------------------------------------------- "
  2. " GadgetActivation Class is a Singleton class that allows the user to  "
  3. " reference Gadget Activation flags without having to remember their   "
  4. " actual hexadecimal values.                                           "
  5. ""
  6. " The User does NOT need to create one of these, since Intuition Class "
  7. " will instantiate the only needed instance of this Class.  See the    "
  8. " SetupIntuition.st source file for the method(s) that help the User   "
  9. " with this Class.                                                     "
  10. ""
  11. " ALL singleton classes MUST contain the following:                    "
  12. ""
  13. "   the methods:  isSingleton AND privateSetup     AND                 "
  14. "                 uniqueInstance Class instance variable.              "
  15. " -------------------------------------------------------------------- "
  16.  
  17. Class GadgetActivation :Dictionary ! uniqueInstance !
  18. [
  19.    isSingleton
  20.      ^ true  
  21. |  
  22.    privateNew ! newinstance !
  23.      newinstance <- super new.
  24.  
  25.      ^ newinstance
  26. |
  27.    new
  28.      ^ (self privateSetup)
  29. |
  30.    privateSetup
  31.      (uniqueInstance isNil)
  32.        ifTrue: [uniqueInstance <- self privateNew.
  33.  
  34.                 self at: #GACT_STRINGLEFT   put: 0. 
  35.                 self at: #GACT_RELVERIFY    put: 1.
  36.                 self at: #GACT_IMMEDIATE    put: 2.
  37.                 self at: #GACT_ENDGADGET    put: 4.
  38.                 self at: #GACT_FOLLOWMOUSE  put: 8.
  39.  
  40.                 self at: #GACT_RIGHTBORDER  put: 16r10.
  41.                 self at: #GACT_LEFTBORDER   put: 16r20.
  42.                 self at: #GACT_TOPBORDER    put: 16r40.
  43.                 self at: #GACT_BOTTOMBORDER put: 16r80.
  44.      
  45.                 self at: #GACT_TOGGLESELECT put: 16r100.
  46.                 self at: #GACT_STRINGCENTER put: 16r200.
  47.                 self at: #GACT_STRINGRIGHT  put: 16r400.
  48.                 self at: #GACT_LONGINT      put: 16r800.
  49.  
  50.                 self at: #GACT_ALTKEYMAP    put: 16r1000.
  51.                 self at: #GACT_BOOLEXTEND   put: 16r2000.
  52.                 self at: #GACT_STRINGEXTEND put: 16r2000.
  53.                 self at: #GACT_ACTIVEGADGET put: 16r4000.
  54.  
  55.                 "Neither set nor rely on this bit:"
  56.  
  57.                 self at: #GACT_BORDERSNIFF  put: 16r8000. 
  58.                ].
  59.                
  60.      ^ self "uniqueInstance??"
  61. ]
  62.